<!--
  * 商品明细
-->
<template>
  <a-table :columns="columns" :pagination="false" rowKey="id" size="small" bordered>
    <template #bodyCell="{ text, record, column }">
      <template v-if="column.dataIndex === 'goods_name'">
        <CopyText :text="record.goods?.goods_name">
          {{ record.goods?.goods_name }}
        </CopyText>
      </template>
      <template v-if="column.dataIndex === 'img'">
        <div class="smart-table-operate">
          <a-image :width="record?.goods?.img ? 30 : 50" :src="record?.goods?.img || failImg" />
        </div>
      </template>
    </template>
  </a-table>
</template>
<script setup lang="ts">
import failImg from '@/assets/images/notice/failImg.png'
import { useTransformSpec } from '@/hooks/web/use-transform-spec'
const { getSpecQuantity } = useTransformSpec()

const columns = reactive([
  {
    title: '图片',
    dataIndex: 'img'
  },
  {
    title: '商品名称',
    dataIndex: 'goods_name'
  },
  {
    title: '规格',
    dataIndex: ['spec', 'spec_name']
  },
  {
    title: '单位',
    dataIndex: ['spec', 'unit_name']
  },
  {
    title: '调拨数量',
    dataIndex: 'num'
  },
  {
    title: '商品备注',
    dataIndex: 'remark'
  }
])
</script>
